#include "assertion.h"
#include <cmath>

namespace uzu
{
    bool Assertion::Equal(float a, float b)
    {
        if (fabs(a - b) > A_TOL) return false;
        if (fabs(a - b) / fabs(b) > R_TOL) return false;
        return true;
    }

    bool Assertion::Equal(float* a, float* b, int count)
    {
        for (int i = 0; i < count; ++i)
        {
            if (!Assertion::Equal(a[i], b[i])) return false;
        }
        return true;
    }
}
